package com.zzh.rabbit;


import android.Manifest;
import android.os.Bundle;
import android.util.Log;

import com.zzh.mvvm.base.BaseRabbitActivity;
import com.zzh.mvvm.bus.RxBus;
import com.zzh.rabbit.databinding.ActSelectImageBinding;

import java.util.Map;
import java.util.Set;

import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.ObservableEmitter;
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
import io.reactivex.rxjava3.functions.Consumer;

/**
 * Created by zzh on 2023/5/26.
 *
 * @date: 2023/5/26 09:46
 * @email: zzh_hz@126.com
 * @author: zzh
 * @description: com.zzh.rabbit
 */
public class SelectImageActivity extends BaseRabbitActivity<SelectImageViewModel, ActSelectImageBinding> {
    ActivityResultLauncher<String[]> launcher;
    @Override
    protected void initViewAndData(Bundle savedInstanceState) {

        //ActivityResultContracts.RequestMultiplePermissions

        RxBus.doTask(new RxBus.OnTaskConsumer<String>() {
            @Override
            public ObservableOnSubscribe<String> createTaskSource() {
                return emitter -> emitter.onNext("");
            }

            @Override
            public Consumer<String> createConsumer() {
                return new Consumer<String>() {
                    @Override
                    public void accept(String s) throws Throwable {

                    }
                };
            }
        });
    }

    @Override
    public void setListener() {
        super.setListener();
        bind.btnChooseImage.setOnClickListener(v -> {
            viewModel.refresh();
        });
    }

    @Override
    protected int initVariableId() {
        return BR.viewModel;
    }
}
